package com.museum.controller.api.admin;

import com.alibaba.fastjson.JSONObject;
import com.museum.base.BaseResponse;
import com.museum.entity.DTO.admin.AdminQueryUser;
import com.museum.entity.DTO.user.UserAdd;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;


@Api(tags = "Super-用户管理")
public interface AdminUserAPI {
    /**
     * 查询所有用户
     *
     * @return
     */
    @ApiOperation("条件分页查询")
    @PostMapping("pageUserCondition/{current}/{limit}")
    BaseResponse<JSONObject> getAllUser(@PathVariable long current, @PathVariable long limit,
                                        @RequestBody(required = false) AdminQueryUser userQuery);

    /**
     * 根据用户的userId 删除用户 同时删除关联的user_role表
     *
     * @return
     */
    @Transactional
    @ApiOperation("根据用户ID删除用户")
    @DeleteMapping("deleteUser/{userId}")
    BaseResponse<JSONObject> deleteId(HttpServletRequest request, @PathVariable("userId") Integer userId);
    /**
     * @param
     * @Desciption 管理员新增用户
     * @return
     */
    @Transactional
    @ApiOperation("添加用户")
    @PostMapping("addUser")
    BaseResponse<JSONObject> AddUser(HttpServletRequest request, @RequestBody @ApiParam(name = "添加用户") UserAdd userAdd);

    /**
     * @param
     * @Desciption 修改用户
     * @return
     */
    @Transactional
    @ApiOperation("修改用户")
    @PutMapping("/updateUser")
    BaseResponse<JSONObject> updateUser(@RequestBody UserAdd user);
}
